package com.asset.salesforce.view;

import java.awt.Color;
import java.net.URL;

import com.asset.salesforce.domain.Account;
import com.asset.salesforce.domain.Invoice;
import com.asset.salesforce.domain.Lead;

import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

public class FormTable {

	public static Font normalFont = new Font(FontFactory.getFont(String.valueOf(Font.TIMES_ROMAN),BaseFont.TIMES_ROMAN,9,Font.NORMAL));
	
	public PdfPTable pdfPTable(Invoice invoice,Account account,Lead lead)throws Exception{
		
		//Arial Font Settings
		/////////////////////////////////////////////////////////////////
	    int fontSize = 10;
		String fontName = "arial.ttf";
	    ClassLoader fontcl = FormTable.class.getClassLoader();
	    URL extUrl = fontcl.getResource(fontName);
	    String fontPath = extUrl.toString();
	    Font Arial = FontFactory.getFont(fontPath,BaseFont.IDENTITY_H, fontSize);
  		Font formFont = FontFactory.getFont(fontPath,BaseFont.IDENTITY_H,10,Font.NORMAL);
	    ////////////////////////////////////////////////////////////////////
	    
	    //Beginning first Form Table
	    //////////////////////////////////////////////////////////////////////
		PdfPTable formTable = new PdfPTable(1);
	  	formTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
	  	PdfPCell formcell;
	  	///formTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
	  	//////////////////////////////////////////////////////////////////
	  		//Date Cell
	  		formcell = new PdfPCell(new Phrase("Date:", Arial));
	  		formcell.setBorder(Rectangle.NO_BORDER);
	  		formTable.addCell(formcell);
			/////////////////////////////////////////
			//Company Name Cell
			formcell = new PdfPCell(new Phrase("Company Name:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			//////////////////////////////////////////////////////////////
			//Company Address
			formcell = new PdfPCell(new Phrase("Company Address:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			///////////////////////////////////////////////////////
			//Company Telephone
			formcell = new PdfPCell(new Phrase("Company Phone:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			///////////////////////////////////////////////////////
			//Company Mobile
			formcell = new PdfPCell(new Phrase("Company Mobile:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			//Website Cell
	  		formcell = new PdfPCell(new Phrase("Website:", Arial));
	  		formcell.setBorder(Rectangle.NO_BORDER);
	  		formTable.addCell(formcell);
			/////////////////////////////////////////////////////////////////////////////
			//Space 
			formcell = new PdfPCell(new Phrase("", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			formcell = new PdfPCell(new Phrase("", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			////////////////////////////////////////////////////////////////////////////
			//Contact Name Cell
			formcell = new PdfPCell(new Phrase("Contact Name:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			/////////////////////////////////////////////////////////////////////////
			//Contact Address Cell
			formcell = new PdfPCell(new Phrase("Address:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			////////////////////////////////////////////////////////////////////////////
			//Contact Telephone
			formcell = new PdfPCell(new Phrase("Contact Phone:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			////////////////////////////////////////////////////////////////////////////
			//Contact Mobile
			formcell = new PdfPCell(new Phrase("Mobile:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			////////////////////////////////////////////////////////////////////////////////
			//Contact Email
			formcell = new PdfPCell(new Phrase("Contact Email:", Arial));
			formcell.setBorder(Rectangle.NO_BORDER);
			formTable.addCell(formcell);
			///////////////////////////////////////////////////////////////////////////////
			//Second Table of First Table
			PdfPTable secondOfFirstTable = new PdfPTable(1);
			secondOfFirstTable.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
			secondOfFirstTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
			secondOfFirstTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
			secondOfFirstTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_RIGHT);
		  	PdfPCell secondOfFirstCell;
		  	//secondOfFirstTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
		  	formFont.setColor(new Color (105, 105, 105));
		  	////////////////////////////////////////////////////////////////////////////
		  	//Date Cell
	  		String datesubstring = invoice.getDateCreated().toString().substring(0, 10);
			String[] datesplit = datesubstring.split("-");
			String dateFinal = datesplit[2]+"/" +datesplit[1]+"/" +datesplit[0];
			secondOfFirstCell = new PdfPCell(new Phrase(dateFinal,formFont));
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		///////////////////////////////////////////////////////////////////////////////////////
	  		//Company Name Cell
	  		if(invoice.getContact()!=null){
	  		  if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
	  			if(invoice.getContact().getViewType().equalsIgnoreCase("lead")){
	  				if(lead.getCompanyName()!=null&&!lead.getCompanyName().equalsIgnoreCase("")){
	  					secondOfFirstCell = new PdfPCell(new Phrase(lead.getCompanyName(), formFont));
	  				}
	  				else{
	  					secondOfFirstCell = new PdfPCell(new Phrase("  ", formFont));
	  				}
	  			}
	  				
	      		else if(invoice.getContact().getViewType().equalsIgnoreCase("account")){
	      			if(account.getCompanyName()!=null&&!account.getCompanyName().equalsIgnoreCase("")){
	      				secondOfFirstCell = new PdfPCell(new Phrase(account.getCompanyName(), formFont));
	      			}
	      			else{
	      				secondOfFirstCell = new PdfPCell(new Phrase(" ", formFont));
	      			}
	      		}
	  		  }
	  		}
	  		else{
	  			secondOfFirstCell = new PdfPCell(new Phrase("  ", formFont));
	  		}	  			
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		//////////////////////////////////////////////////////////////////////////////////////////
	  		//Sate Cell
	  		if(invoice.getContact()!=null){
	  		  if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
	  			if(invoice.getContact().getViewType().equalsIgnoreCase("lead"))
	  				if(lead.getStreet()!=null){
	  					String leadStreet=lead.getStreet();
	  					if(leadStreet==null){
	  						leadStreet = new String("  ");
	  					}  				
	  					String leadState=lead.getState();
	  					if(leadState==null){
	  						leadState = new String("  ");
	  					}
	  					secondOfFirstCell = new PdfPCell(new Phrase(leadStreet+" "+leadState, formFont));
	  				}
	  				else{
	  					secondOfFirstCell = new PdfPCell(new Phrase("                ", formFont));
	  				}
	      		else if(invoice.getContact().getViewType().equalsIgnoreCase("account"))
	      			if(account.getState()!=null){
	      				String accountStreet=account.getStreet();
	      				if(accountStreet==null){
	      					accountStreet=new String("  ");
	      				}
	  					String accountState=account.getState();
	  					if(accountState==null){
	  						accountState=new String("  ");
	      				}
	      				secondOfFirstCell = new PdfPCell(new Phrase(accountStreet+"  "+accountState, formFont));
	      			}
	      			else{
	      				secondOfFirstCell = new PdfPCell(new Phrase("               ", formFont));
	      			}
	  			}
	  		}
	  		else{
	  			secondOfFirstCell = new PdfPCell(new Phrase("         ", formFont));
	  		}
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		/////////////////////////////////////////////////////////////////////////////////////
	  		//Phone Cell
	  		if(invoice.getContact()!=null){
	  			 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
	  			if(invoice.getContact().getViewType().equalsIgnoreCase("lead"))
	  				if(lead.getPhone()!=null&&!lead.getPhone().equalsIgnoreCase("")){
	  					secondOfFirstCell = new PdfPCell(new Phrase(lead.getPhone(), formFont));
	  				}
	  				else{
	  					secondOfFirstCell = new PdfPCell(new Phrase("            ", formFont));
	  				}
	      		else if(invoice.getContact().getViewType().equalsIgnoreCase("account"))
	      		if(account.getPhone()!=null&&!account.getPhone().equalsIgnoreCase("")){
	      			secondOfFirstCell = new PdfPCell(new Phrase(account.getPhone(), formFont));
	      		}
	      		else{
	      			secondOfFirstCell = new PdfPCell(new Phrase("              ", formFont));
	      		}
	  		  }
	  		}
	  		else{
	  			secondOfFirstCell = new PdfPCell(new Phrase("             ", formFont));
	  		}
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		///////////////////////////////////////////////////////////////////////
			//Mobile Cell
			if(invoice.getContact()!=null){
			 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
			if(invoice.getContact().getViewType().equalsIgnoreCase("lead"))
				if(lead.getMobile()!=null&&!lead.getMobile().equalsIgnoreCase("")){
					secondOfFirstCell = new PdfPCell(new Phrase(lead.getMobile(), formFont));
				}
				else{
					secondOfFirstCell = new PdfPCell(new Phrase("             ", formFont));
				}
			else if(invoice.getContact().getViewType().equalsIgnoreCase("account"))
			secondOfFirstCell = new PdfPCell(new Phrase(account.getMobile(), formFont));
			 }
			}
			else{
			secondOfFirstCell = new PdfPCell(new Phrase("                  ", formFont));
			}
			secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
			secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
			secondOfFirstTable.addCell(secondOfFirstCell);
			///////////////////////////////////////////////////////////////////////
			//webSite Cell
	  		if(invoice.getContact()!=null){
	  		 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
	  			if(invoice.getContact().getViewType().equalsIgnoreCase("lead"))
	  				if(lead.getWebSite()!=null){
	  					secondOfFirstCell = new PdfPCell(new Phrase(lead.getWebSite(), formFont));
	  				}
	  				else{
	  					secondOfFirstCell = new PdfPCell(new Phrase("              ", formFont));
	  				}
	      		else if(invoice.getContact().getViewType().equalsIgnoreCase("account"))
	      			if(account.getWebSite()!=null){
	      				secondOfFirstCell = new PdfPCell(new Phrase(account.getWebSite(), formFont));
	      			}
	      			else{
	      				secondOfFirstCell = new PdfPCell(new Phrase("                 ", formFont));
	      			}
	  			}
	  		}
	  		else{
	  			secondOfFirstCell = new PdfPCell(new Phrase("             ", formFont));
	  		}
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		/////////////////////////////////////////////////////////////////////////////
	  		//Space 
	  		secondOfFirstCell = new PdfPCell(new Phrase("", Arial));
			secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
			secondOfFirstTable.addCell(secondOfFirstCell);
			secondOfFirstCell = new PdfPCell(new Phrase("", Arial));
			secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
			secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
			secondOfFirstTable.addCell(secondOfFirstCell);
			/////////////////////////////////////////////////////////////////////////////
			//Contact Name Cell
	  		if(invoice.getContact()!=null){
	  			 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
	  			if(invoice.getContact().getfName()!=null&&!invoice.getContact().getfName().equalsIgnoreCase("")){
	  				secondOfFirstCell = new PdfPCell(new Phrase(invoice.getContact().getfName(), formFont));
	  			}
	  			else{
	  				secondOfFirstCell = new PdfPCell(new Phrase("                  ", formFont));
	  			}
	  		 }
	  		}
	  		else{
	  			secondOfFirstCell = new PdfPCell(new Phrase("              ", formFont));
	  		}
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		///////////////////////////////////////////////////////////////////////////
	  		//Contact Address Cell
	  		if(invoice.getContact()!=null){
	  			 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
	  			if(invoice.getContact().getViewType().equalsIgnoreCase("lead"))
	  				if(lead.getStreet()!=null){
	  					String leadStreet=lead.getStreet();
	  					if(leadStreet==null){
	  						leadStreet = new String("  ");
	  					}  				
	  					String leadState=lead.getState();
	  					if(leadState==null){
	  						leadState = new String("  ");
	  					}
	  					secondOfFirstCell = new PdfPCell(new Phrase(leadStreet+" "+leadState, formFont));
	  				}
	  				else{
	  					secondOfFirstCell = new PdfPCell(new Phrase("                ", formFont));
	  				}
	      		else if(invoice.getContact().getViewType().equalsIgnoreCase("account"))
	      			if(account.getState()!=null){
	      				String accountStreet=account.getStreet();
	      				if(accountStreet==null){
	      					accountStreet=new String("  ");
	      				}
	  					String accountState=account.getState();
	  					if(accountState==null){
	  						accountState=new String("  ");
	      				}
	      				secondOfFirstCell = new PdfPCell(new Phrase(accountStreet+"  "+accountState, formFont));
	      			}
	      			else{
	      				secondOfFirstCell = new PdfPCell(new Phrase("               ", formFont));
	      			}
	  		}
	  		}
	  		else{
	  			secondOfFirstCell = new PdfPCell(new Phrase("         ", formFont));
	  		}
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
			//////////////////////////////////////////////////////////////////////////////////////
	  		//Contact Phone Cell
			if(invoice.getContact()!=null){
				 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
				if(invoice.getContact().getPhone()!=null&&!invoice.getContact().getPhone().equalsIgnoreCase("")){
					secondOfFirstCell = new PdfPCell(new Phrase(invoice.getContact().getPhone(), formFont));
				}
				else{
					secondOfFirstCell = new PdfPCell(new Phrase("                 ", formFont));
				}
			  }
			}
			else{
			secondOfFirstCell = new PdfPCell(new Phrase("                 ", formFont));
			}
			secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
			secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
			secondOfFirstTable.addCell(secondOfFirstCell);
	  		///////////////////////////////////////////////////////////////////////////////////////////////
			//Contact Mobile Cell
		    if(invoice.getContact()!=null){
		    	if(invoice.getContact().getMobile()!=null&&!invoice.getContact().getMobile().equalsIgnoreCase("")){
		    		secondOfFirstCell = new PdfPCell(new Phrase(invoice.getContact().getMobile(), formFont));
		    	}
		    	else{
		    		secondOfFirstCell = new PdfPCell(new Phrase("                ", formFont));
		    	}
		    }
		    else{
		    	secondOfFirstCell = new PdfPCell(new Phrase("                ", formFont));
		    }
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		//////////////////////////////////////////////////////////////////////////////////////////////
	  		//Contact Mobile Cell
		    if(invoice.getContact()!=null){
		    	 if(invoice.getContact().getViewType() != null && invoice.getContact().getViewType().equalsIgnoreCase("")){
		    	if(invoice.getContact().getEmail()!=null&&!invoice.getContact().getEmail().equalsIgnoreCase("")){
		    		secondOfFirstCell = new PdfPCell(new Phrase(invoice.getContact().getEmail(), formFont));
		    	}
		    	else{
		    		secondOfFirstCell = new PdfPCell(new Phrase("                      ", formFont));
		    	}
		     }
		    }
		    else{
		    	secondOfFirstCell = new PdfPCell(new Phrase("                      ", formFont));
		    }
	  		secondOfFirstCell.setBorder(Rectangle.NO_BORDER);
	  		secondOfFirstCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
	  		secondOfFirstTable.addCell(secondOfFirstCell);
	  		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	  		//Final First Form
	  		PdfPTable finalFirstFormTable = new PdfPTable(2);
	  		//finalFirstFormTable.setWidthPercentage(100);
	  		finalFirstFormTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
		        
		        PdfPCell finalFirstFormCell = new PdfPCell(formTable);
		        //formCellFinal.setPaddingRight(2);
		        finalFirstFormCell.setBorder(Rectangle.NO_BORDER);    
		        finalFirstFormTable.addCell(finalFirstFormCell);
		        
		        finalFirstFormCell = new PdfPCell(secondOfFirstTable);
		        finalFirstFormCell.setBorder(Rectangle.NO_BORDER);
		        //formCellFinal.setPaddingLeft(2);
		        finalFirstFormTable.addCell(finalFirstFormCell);
		        float[] columnWidths = new float[] {30f,80f};
		        finalFirstFormTable.setWidths(columnWidths);	
	  		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	  		//Second Table Form
		    PdfPTable arabTable = new PdfPTable(1);
		    arabTable.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
		    arabTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
	      	PdfPCell arabcell;
	      	///////////////////////////////////////////////////////////////////////
	      	//Date Cell
	      Paragraph arab =  new Paragraph("التاريخ:",Arial);
	      arab.setAlignment(Element.ALIGN_RIGHT);
	      arabcell = new PdfPCell(arab);
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	     ///////////////////////////////////////////////////////////////////////////
	      //Company Cell
	      arabcell = new PdfPCell(new Paragraph("اسم الشركة:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      /////////////////////////////////////////////////////////////////////////
	      //Address
	      arabcell = new PdfPCell(new Paragraph("العنوان:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      ////////////////////////////////////////////////////////////////
	      //Phone Cell
	      arabcell = new PdfPCell(new Paragraph("التليفون الارضي:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      ////////////////////////////////////////////////////////////////
	      //Mobile Cell
	      arabcell = new PdfPCell(new Paragraph("التليفون المحمول:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      arabcell = new PdfPCell(new Paragraph("الموقع الالكتروني:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      
	      ////////////////////////////////////////////////////////////////
	      //Space
	      arabcell = new PdfPCell(new Phrase("", Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      arabcell = new PdfPCell(new Phrase("", Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
		  /////////////////////////////////////////////////////////////////////////
	      //Contact Name Cell
	      arabcell = new PdfPCell(new Paragraph("اسم العميل/ممثل الشركة:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      ///////////////////////////////////////////////////////////////////////////
	      arabcell = new PdfPCell(new Paragraph("العنوان:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);	      
	      ////////////////////////////////////////////////////////////////
	      //Phone Cell
	      arabcell = new PdfPCell(new Paragraph("التليفون الارضي:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      ////////////////////////////////////////////////////////////////
	      //Mobile Cell
	      arabcell = new PdfPCell(new Paragraph("التليفون المحمول:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
	      //////////////////////////////////////////////////////////////////      
	      arabcell = new PdfPCell(new Paragraph("البريد الالكتروني:",Arial));
	      arabcell.setBorder(Rectangle.NO_BORDER);
	      arabTable.addCell(arabcell);
//	      float[] arabcolumnWidths = new float[] {1f};
//	      arabTable.setWidths(arabcolumnWidths);
	      /////////////////////////////////////////////////////////////////
	      //Final Table
	      PdfPTable formTableFinal = new PdfPTable(2);
	      formTableFinal.setWidthPercentage(100);
	      formTableFinal.getDefaultCell().setBorder(Rectangle.NO_BORDER);
	        
	        PdfPCell formCellFinal = new PdfPCell(finalFirstFormTable);
	        //formCellFinal.setPaddingRight(2);
	        formCellFinal.setBorder(Rectangle.NO_BORDER);    
	        formTableFinal.addCell(formCellFinal);
	        
	        formCellFinal = new PdfPCell(arabTable);
	        formCellFinal.setBorder(Rectangle.NO_BORDER);
	        //formCellFinal.setPaddingLeft(2);
	        formTableFinal.addCell(formCellFinal);
		    float[] arabcolumnWidths = new float[] {100f,20f};
		    formTableFinal.setWidths(arabcolumnWidths);
		    formTableFinal.setSpacingBefore(30f);
			return formTableFinal;
	}
}
